﻿using System.Data;
using System.Data.SqlClient;
using CoreLibrary.Sql;

namespace CoreLibrary.Repo.Sql {

    public class RemoveAll : ISqlUpdator<bool> {
        
        private readonly string _tableName;

        public RemoveAll(string tableName) {
            _tableName = tableName;
        }

        public string GetSQL() {
            return string.Format("DELETE FROM {0}", _tableName);
        }

        public void SetParameters(SqlCommand command) {
            command.CommandType = CommandType.Text;
        }

        public bool GetResult(SqlConnection conn, int result) {
            return result > 0;
        }

    }
}